﻿using Unread.App.ViewModels;
using Windows.Storage;
using System;
using Windows.Storage.Pickers;
using Windows.UI.ApplicationSettings;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml.Controls.Primitives;

namespace Unread.App.Views
{
    public sealed partial class OpmlPage : Unread.App.Common.LayoutAwarePage
    {
        public OpmlViewModel ViewModel
        {
            get
            {
                return DataContext as OpmlViewModel;
            }
        }

        public OpmlPage()
        {
            this.InitializeComponent();

            DataContext = ServicesFactory.GetInstance<OpmlViewModel>();
        }

        protected override void GoBack(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            var parent = this.Parent as Popup;
            if (parent != null)
                parent.IsOpen = false;

            if (ApplicationView.Value != ApplicationViewState.Snapped)
                SettingsPane.Show();
        }
    }
}